<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>添加商品类型</title>
	<hdjs/>
	<js file="__CONTROL_TPL__/js/js.js">
		<js file="__CONTROL_TPL__/js/addSpec.js">
</head>
<body>
	<div class="menu_list">
		<ul>
			<li><a href="{|U:'index'}">商品列表</a></li>
			<li><a href="{|U:'showCategory'}"  class="action">添加商品</a></li>
		</ul>
	</div>
	<div class="title-header">添加商品</div>
	<div class="tab">
		<ul class="tab_menu">
			<li lab="base">
				<a> 基本参数</a>
			</li>
			<li lab="content" class="action">
				<a>内容</a>
			</li>
			<li lab='pic'>
				<a>图片</a>
			</li>
		</ul>
		<form action="" class="hd-form" method="post" enctype="multipart/form-data">
			<input type="hidden" name="cname" value="{$category['cname']}">
			<input type="hidden" name="cid" value="{$category['cid']}">
			<input type="hidden" name="gtid" value="{$goods_type['gt_id']}">
			<div class="tab_content">
				<div id="base">
					<table class="table1">
						<tr>
							<th class="w100"> 商品名称 </th>
							<td >
								<input type="text" name="gname" class="w500"/>
							</td>
						</tr>
						<tr>
							<th> 属性 </th>
							<td>
								<input type="checkbox" name="flag[]" value="推荐"/> 推荐
								<input type="checkbox" name="flag[]" value="置顶" id=""> 置顶
							</td>
						</tr>
						<tr>
							<th> 栏目 </th>
							<td>
								{$category['cname']}
							</td>
						</tr>
						<tr>
							<th> 商品类型 </th>
							<td>
								{$goods_type['gtname']}
							</td>
						</tr>

						
						<tr>
							<th>属性</th>
							<td>
								<table>
									<list from="$attrForm" name="n">
										<tr>
											<th>{$n.attr_name}</th>
											<td>{$n.html}</td>
										</tr>
									</list>
								</table>
							</td>
						</tr>
						<if value="!empty($attrSpecForm)">
						<tr>
							<th>规格</th>
							<td>
								<table>
										<tr class="title-header">
											<list from="$attrSpecForm" name="spec">
												<td>{$spec.attr_name}</td>
											</list>
											<td class="w80">价格</td>
											<td class="w80">库存</td>
											<td class="w150">货号</td>
											<td class="w150">样图</td>
											<td><a onclick="addSpec(this)" cursor="pointer" href="javascript:">添加规格</a></td>
										</tr>
										<tr class="gg">
											<list from="$attrSpecForm" name="spec">
												<td>{$spec.html}</td>
											</list>
											
											<td><input type="text" name="spec[price][]" id=""></td>
											<td><input type="text" name="spec[stock][]" id=""></td>
											<td><input type="text" name="spec[goods_sn][]" id=""></td>
											<td class="w150"><input type="file" name="pics[]"/></td>
											<td><a onclick="delSpec(this)" cursor="pointer" href="javascript:">删除规格</a></td>
										</tr>
									
								</table>
							</td>

						</tr>		
						</if>
						<if value="empty($attrSpecForm)">
							<tr>
							<th> 价格 </th>
							<td>
								<input type="text" name="price" id="">
							</td>
							</tr>
							<tr>
							<th> 库存 </th>
							<td>
								<input type="text" name="stock" id="">
							</td>
							</tr>
							<tr>
							<th> 货号 </th>
							<td>
								<input type="text" name="goods_sn" id="">
							</td>
							</tr>
						</if>

						<tr>
							<th> 品牌 </th>
							<td>
								<select name="bid" id="" class="w100">
									<option value="" selected="">请选择品牌=</option>
									<list from="$brand" name = "b">
										<option value="{$b.bid}">{$b.bname}</option>
									</list>
								</select>
							</td>
						</tr>
						<tr>
							<th> 关键字 </th>
							<td>
								<input type="text" name="keywords" class="w400"/>
							</td>
						</tr>
						<tr>
							<th> 描述 </th>
							<td>
								<textarea name="description" id="" cols="30" rows="10" class="w400 h100">{$data.description}</textarea>
							</td>
						</tr>
						
						<tr>
							<th> 录入时间 </th>
							<td>
								<input type="text" name="addtime" id="addtime" readonly="readonly" value="{|date:'Y/m/d h:i:s'}"/>
							</td>
							<script>
								
									$('#addtime').calendar({format:'yyyy/MM/dd HH:mm:ss'});
								
							</script>
							
						</tr>
						
						<tr>
							<th> 服务 </th>
							<td>
								<input type="text" name="service"/>
							</td>
						</tr>
						<tr>
							<th> 点击量 </th>
							<td>
								<input type="text" name="click"/>
							</td>
						</tr>
					</table>
				</div>
				<div id="content">
					<table class="table1">
						<tr>
							<th class="w100">内容</th>
							<td>
								<ueditor name="body"/>
							</td>
						</tr>
						
					</table>
				</div>

				<div id="pic">
					<table class="table1">
						<tr>
							<th class="w100">产品主图</th>
							<td>
								<input type="file" name="index_pic"/>
							</td>
						</tr>
						<tr>
							<th> 列表页图 </th>
							<td>
								<input type="file" name="list_pic"/>
							</td>
						</tr>

						<tr>
							<th> 内容页图 </th>

							<td>
								<ul id="old_cpics" style="width:700px;">
									<list from="$pics" name="pic">
										<li style="float:left;margin-right:10px;position:relative;">
											<img src="__ROOT__/{$pic.small}" alt="" class="w150">
											<span id="spandelpic" onclick="delold(this)" picid="{$pic.pic_id}" style="border:1px solid #333;text-align:center;font-wigth:700;cursor:pointer;display:block;width:15px;height:20px;line-height:20px;background:#fff;position:absolute;top:3px;right:5px;z-index:5px;">X</span>

										</li>
									</list>
								</ul>
								<div style="clear:both;">
								<input type="file" name="pics[]"/>
								<button class="hd-cancel" type="button" onclick="addPics();">添加</button></div>

								<ul id="content_pic" style="margin-top:5px;">

								</ul>
							</td>
							
						</tr>
						
					</table>
				</div>
			</div>
			<div class="position-bottom"><input type="submit" value="添加" name="submit" class="hd-success" style="margin-left:30px;"></div>
			

		</form>
	</div>
		
	<script>
		validate:{
			$(function(){
				$('form').validate({
					gname:{
						rule:{
							required:true
						},
						error:{
							required:'商品名不能为空'
						}
					}
					
				})
			})
		}
	</script>
</body>
</html>